package net.huashitong.goodinfo.service;

import com.sirdc.modules.core.dao.BaseDao;
import com.sirdc.modules.sys.base.StringPKService;
import com.sirdc.modules.sys.service.SysTableService;
import net.huashitong.goodinfo.dao.GoodsInfoDao;
import net.huashitong.goodinfo.entity.GoodsInfo;
import net.huashitong.goodinfo.filter.GoodsInfoFilter;
import net.huashitong.goodsclass.entity.GoodsClasses;
import net.huashitong.goodsclass.filter.GoodsClassFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class GoodsInfoService extends StringPKService<GoodsInfo> {
    @Autowired
    private GoodsInfoDao dao;
    @Autowired
    private SysTableService tableService;

    @Override
    protected BaseDao<GoodsInfo, String> getDao() {
        return dao;
    }
    @Override
    protected void beforeSave(GoodsInfo obj) {
        obj.setSysId(tableService.updateMaxSysId("t_goods_info", null));
    }


    public List<GoodsInfo> queryPageList(GoodsInfoFilter filter)
    {
        List<GoodsInfo> query = dao.query(filter);
        return query;
    }

}
